﻿/*----------------------------------------------------------------
  //Copyright (C) 2012 赵国伟
  //文件功能描述：我的信息管理
  //创建人：赵国伟
  //生成时间：2012/03/17 16:15:00
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Shopping.Common;
using Shopping.Model;
using Shopping.BLL;

public partial class Home_MyUserInfo : BaseUserPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            UsersManage umanage = new UsersManage();
            var u = umanage.GetUserInfo(UserID);
            this.mobile1.Value = u.Mobile;
            this.email1.Value = u.Email;
        }
    }
    protected void Unnamed1_Click(object sender, ImageClickEventArgs e)
    {
        if (string.IsNullOrEmpty(this.email1.Value))
        {
            Response.Write("<script type='text/javascript'>alert('请输入邮箱地址');</script>");
            return;
        }
        if (string.IsNullOrEmpty(this.mobile1.Value))
        {
            Response.Write("<script type='text/javascript'>alert('请输入手机号码');</script>");
            return;
        }
        UsersManage umanage = new UsersManage();
        var u = umanage.GetUserInfo(UserID);
        u.Email = this.email1.Value;
        u.Mobile = this.mobile1.Value;
        var ret = umanage.UpdateUsersInfo(u);
        if (ret.Result == ResultType.Success)
        {
            Response.Write("<script type='text/javascript'>alert('基本信息更新成功');</script>");
        }
        else
        {
            Response.Write("<script type='text/javascript'>alert('更新操作失败，失败原因：" + ret.Message + "');</script>");
        }
    }
}